<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js" type="text/javascript" ></script>
<script src=" https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript" ></script>
<%-- <script src="./common/js/jquery-ui-timepicker-addon.js" type="text/javascript" ></script> --%>
<script type="text/javascript">
	function validation() {
		var frm = document.forms(0);
		if (frm.subject.value == "") {
			alert("제목을 입력해주세요.");
			return false;
		} else if (frm.manmax.value == "" || isNaN(frm.manmax.value)) {
			alert("남자신청자수를 숫자로 입력해주세요.");
			return false;
		}  else if (frm.ladymax.value == "" || isNaN(frm.ladymax.value)) {
			alert("여자신청자수를 숫자로 입력해주세요.");
			return false;
		} else if (frm.eventdate.value == "") {
			alert("이벤트 참여일을 입력해주세요.");
			return false;
		}else if (frm.content.value == "") {
			alert("내용을 입력해주세요.");
			return false;
		}
		return true;
	}
	$(function(){
	  $.datepicker.regional['ko'] = {
	  closeText: '닫기',
	  prevText: '이전달',
	  nextText: '다음달',
	  currentText: '오늘',
	  monthNamesShort: ['1월','2월','3월','4월','5월','6월',
	  '7월','8월','9월','10월','11월','12월'],
	  dayNames: ['일','월','화','수','목','금','토'],
	  dayNamesShort: ['일','월','화','수','목','금','토'],
	  dayNamesMin: ['일','월','화','수','목','금','토'],
	  weekHeader: 'Wk',
	  dateFormat: 'yy-mm-dd',
	  firstDay: 0,
	  isRTL: false,
	  showMonthAfterYear: true,
	  yearSuffix: ''};
	  $.datepicker.setDefaults($.datepicker.regional['ko']);
		
		$('#selecter').datepicker({ 
		  
		  changeMonth: true,
		  changeYear: true,
		  showButtonPanel: true
		 });
	 });

</script>
<h2 class="page_title"><strong>이벤트 게시판</strong></h2>

<s:if test="resultClass == NULL">
	<form action="EwriteAction.action" method="post" enctype="multipart/form-data" onsubmit="return validation();">
</s:if>
<s:else>
	<form action="EmodifyAction.action" method="post" enctype="multipart/form-data" onsubmit="return validation();">
		<s:hidden name="no" value="%{resultClass.no}" />
		<s:hidden name="currentPage" value="%{currentPage}" />
		<s:hidden name="old_file" value="%{resultClass.file_savname}" />
</s:else>
<P class="align_r">
	<font color="#FF0000">*</font>는 필수입력사항입니다.
</P>
<table class="table_form">
	<tr>
		<th><font color="#FF0000">*</font> 제목</th>
		<td><s:textfield name="subject"
				theme="simple" value="%{resultClass.subject}" cssStyle="width:370px"
				maxlength="50" />
		</td>
	</tr>
	<tr>
		<th><font color="#FF0000">*</font> id </th>
		<td>		
			<input type="text" name="id" value="${session.session_id}" maxlength="20" readonly="readonly"/>
		</td>
	</tr>
	<tr>
		<th><font color="#FF0000">*</font> 닉네임</th>
		<td>	
		<input type="text" name="nickname" value="${session.session_nickname}" maxlength="20" readonly="readonly"/>
		</td>
	</tr>
	<tr>
		<th><font color="#FF0000">*</font> 남성 참여인원수</th>
		<td><s:textfield name="manmax"
				theme="simple" value="%{resultClass.manmax}" 
				maxlength="50" />
		</td>
	</tr>
	<tr>
		<th><font color="#FF0000">*</font> 여성 참여인원수</th>
		<td><s:textfield name="ladymax"
				theme="simple" value="%{resultClass.ladymax}" 
				maxlength="50" />
		</td>
	</tr>
	<tr>
		<th><font color="#FF0000">*</font> 이벤트 참여일</th>
		<td>
			<input type="text" id="selecter" maxlength="12" name="eventdate" value="${resultClass.eventdate}"  />
		</td>
	</tr>
	<tr>
		<th><font color="#FF0000">*</font> 내용</th>
		<td><s:textarea name="content" theme="simple"
				value="%{resultClass.content}" cols="50" rows="10" />
		</td>
	</tr>
	<tr>
		<th>첨부파일</th>
		<td>
		<s:file name="upload" theme="simple" /> 
		<s:if test="resultClass.file_orgname != NULL">
		<p><strong> * <s:property value="resultClass.file_orgname" /></strong> 파일이 등록되어 있습니다. 다시 업로드하면 기존의 파일은 삭제됩니다.</p> 
		</s:if>
		</td>
	</tr>
</table>
<p class="align_r">
	<input name="submit" type="submit" value="작성완료" class="inputb">
	<input name="list" type="button" value="목록" class="inputb"
		onClick="javascript:location.href='ElistAction.action?currentPage=<s:property value="currentPage" />'">
</p>
</form>
